package whlogger.launcher.loginfields.views.eventlistener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import whlogger.launcher.loginfields.views.controller.LogInJPanelController;

/**
 *
 * @author d3rbastl3r
 */
public class LoginJButtonActionListener implements ActionListener{
    private LogInJPanelController   controller  = null;
    private JTextField              nickname    = null;
    private JPasswordField          password    = null;
    
    public LoginJButtonActionListener(){
    }
    
    public void setController(LogInJPanelController controller){
        this.controller = controller;
    }
    
    public void setNickname(JTextField nickname){
        this.nickname = nickname;
    }
    
    public void setPassword(JPasswordField password){
        this.password = password;
    }
    
    @Override
    public void actionPerformed(ActionEvent e) {
        this.controller.setLogInData(
			this.nickname.getText(),
			new String(this.password.getPassword())
        );
    }
}
